package com.whw.fy.controller;


import com.whw.fy.entity.Message;
import com.whw.fy.entity.TeachingDiscussion;
import com.whw.fy.entity.TeachingTodo;
import com.whw.fy.service.TeachingDiscussionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

@Api(tags = "教学讨论模块")
@RestController
@RequestMapping("/api/teachingDiscussion")
public class TeachingDiscussionController {
    @Resource
    private TeachingDiscussionService teachingDiscussionService;

    @ApiOperation(value = "添加教学讨论")
    @PostMapping("/insert")
    public Message insert(TeachingDiscussion teachingDiscussion){
        teachingDiscussion.setTeachingDiscussionPostTime(new Date());
        return teachingDiscussionService.insertSelective(teachingDiscussion);
    }

    @ApiOperation(value = "修改教学讨论")
    @PostMapping("/update")
    public Message update(TeachingDiscussion teachingDiscussion){
        return teachingDiscussionService.updateByPrimaryKeySelective(teachingDiscussion);
    }

    @ApiOperation(value = "根据id修改状态")
    @PutMapping("/status")
    public Message updateStatusById(int status,int id){
        return teachingDiscussionService.updateTeachingDiscussionStatusByTeachingDiscussionId(status,id);
    }

    @ApiOperation(value = "根据id删除教学讨论")
    @DeleteMapping("/")
    public Message deleteById(int id){
        return teachingDiscussionService.deleteByPrimaryKey(id);
    }

    @ApiOperation(value = "查询所有教学讨论")
    @GetMapping("/all")
    public Message selectALL(){
        return teachingDiscussionService.selectAll();
    }

    @ApiOperation(value = "根据id查询教学讨论")
    @GetMapping("/one")
    public Message selectById(int id){
        return teachingDiscussionService.selectByPrimaryKey(id);
    }


    @ApiOperation(value = "根据授课老师id查询旗下获取所有教学讨论")
    @GetMapping("/all/TeacherIdJurisdictionEight")
    public Message selectallByTeacherIdJurisdictionEight(int staffId){
        return teachingDiscussionService.selectallByTeacherIdJurisdictionEight(staffId);
    }

    @ApiOperation(value = "根据教学主管id查询旗下所有教学讨论")
    @GetMapping("/all/TeachingDirectorJurisdictionSix")
    public Message selectallByTeachingDirectorJurisdictionSix(int staffId){
        return teachingDiscussionService.selectallByTeachingDirectorJurisdictionSix(staffId);
    }

    @ApiOperation(value = "根据主责老师id查询旗下所有教学讨论")
    @GetMapping("/all/principalTeacherJurisdictionSeven")
    public Message selectallByprincipalTeacherJurisdictionSeven(int staffId){
        return teachingDiscussionService.selectallByprincipalTeacherJurisdictionSeven(staffId);
    }





    /*
    @ApiOperation(value = "根据医疗主管id查询旗下所有教学讨论")
    @GetMapping("/all/MedicalDirectorIdJurisdictionZero")
    public Message selectallByMedicalDirectorIdJurisdictionZero(int staffId){
        return teachingDiscussionService.selectallByMedicalDirectorIdJurisdictionZero(staffId);
    }*/
}
